let t = require;
let e = module;
let o = e.exports;
o.default = e.exports;

('use strict');
console.log('start');
var _n22,
  i =
    (this && this.__extends) ||
    ((_n22 = function n(t, e) {
      return (_n22 =
        Object.setPrototypeOf ||
        ({
          __proto__: []
        } instanceof Array &&
          function (t, e) {
            t.__proto__ = e;
          }) ||
        function (t, e) {
          for (var o in e) {
            Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
          }
        })(t, e);
    }),
    function (t, e) {
      function o() {
        this.constructor = t;
      }
      _n22(t, e),
        (t.prototype =
          null === e
            ? Object.create(e)
            : ((o.prototype = e.prototype), new o()));
    });
Object.defineProperty(o, '__esModule', {
  value: !0
}),
  (o.ActivityItemCom = void 0);
var r = t('UIComponent'),
  a = t('ComUtils'),
  s = t('SoundMrg'),
  c = t('CivilizationMrg'),
  l = t('PlayerMrg'),
  u = t('UIMrg'),
  h = t('BuyVitPanel'),
  p = t('GeneralTips'),
  f = t('ResMrg'),
  d = t('BattlePanel'),
  g = t('ChapterDifficultyCfg'),
  _ = t('ActivityPanel'),
  y = t('LangCfg'),
  C = (function (t) {
    function e(e, o) {
      var n = t.call(this, e) || this;
      return (e.active = !0), (n._data = o), n.refresh(), n;
    }
    return (
      i(e, t),
      (e.prototype.onInit = function () {
        t.prototype.onInit.call(this),
          (this._txtPower = a.default.getComponent(
            cc.Label,
            this.view,
            'btnBattle/Background/New Layout/New Layout/txtPower'
          )),
          (this._txtTime = a.default.getComponent(
            cc.RichText,
            this.view,
            'txtTime'
          )),
          (this._txtDifficulty = a.default.getComponent(
            cc.Label,
            this.view,
            'imgDifficulty/txtDifficulty'
          )),
          (this._imgDifficulty = a.default.getComponent(
            cc.Sprite,
            this.view,
            'imgDifficulty'
          )),
          (this._txtReward = a.default.getComponent(
            cc.Label,
            this.view,
            'txtReward'
          )),
          (this._btnBattle = a.default.getComponent(
            cc.Button,
            this.view,
            'btnBattle'
          )),
          this._btnBattle.node.on(
            cc.Node.EventType.TOUCH_END,
            this.onTouchBattleHandler,
            this
          );
      }),
      (e.prototype.onTouchBattleHandler = function () {
        s.SoundMrg.click(),
          l.PlayerMrg.ins.power >= this._data.vit
            ? l.PlayerMrg.ins.enterFb(this._data.id)
              ? (u.UIMrg.show(d.BattlePanel, this._data),
                (l.PlayerMrg.ins.power -= this._data.vit),
                u.UIMrg.close(_.ActivityPanel))
              : p.GeneralTips.show(y.LangCfg.ins.getContent(1011))
            : u.UIMrg.show(h.BuyVitPanel);
      }),
      (e.prototype.onShow = function () {
        t.prototype.onShow.call(this),
          (a.default.getComponent(
            cc.Label,
            this.view,
            'btnBattle/Background/New Layout/txtLabel'
          ).string = y.LangCfg.ins.getContent(200901)),
          (this._txtReward.string = this.getReward().toString()),
          (this._txtTime.string = y.LangCfg.ins.getContent(200902, {
            n: l.PlayerMrg.ins.getFbTime(this._data.id) + '/' + this._data.times
          }));
      }),
      (e.prototype.refresh = function () {
        (this._txtPower.string = 'x' + this._data.vit),
          (this._txtDifficulty.string = y.LangCfg.ins.getContent(
            this._data.name
          )),
          f.ResMrg.loadSpriteByAtlas(
            this._imgDifficulty,
            'Atlas/Fb',
            'difficulty' + this._data.difficulty
          );
      }),
      (e.prototype.getReward = function () {
        var t = g.ChapterDifficultyCfg.ins.getDifficultyData(
          this._data.id,
          1,
          c.CivilizationMrg.ins.level
        );
        return t ? t.reward[0][1] : 0;
      }),
      e
    );
  })(r.UIComponent);
(o.ActivityItemCom = C), console.log('end');
module.exports = e.exports;
